import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      { find: '@assets', replacement: resolve(__dirname, 'src/assets') },
      { find: '@runtime', replacement: resolve(__dirname, 'src/runtime') },
      { find: '@components', replacement: resolve(__dirname, 'src/components') },
    ]
  },
  build: {
    rollupOptions: {
      output:{
        manualChunks(id) {
            if (id.includes('components')) { // 把 components 文件里面的文件都打包到 components.js 中 
                return 'components'
            }
        }
    }},
    outDir: 'D:/1-运行环境/P10052/UI',
    emptyOutDir: true,
    assetsDir: 'assets',
  },
  server: {
    cors: true,
    host: "127.0.0.1",
    open: true
  }
})
